package Tree;

public class Tree {
	private TNode rootNode;
	private TNode currentNode;
	static int i; 

	Tree(String content) {
		rootNode = new TNode(content);
		currentNode = rootNode;
		i = 0;
	}

	void addLeftChild(String leftContent) {
		TNode leftNode = new TNode(leftContent);

		currentNode.setLeftChild(leftNode);
		setCurrentNode(leftNode);
		i++;
	}

	void addRightChild(String rightContent) {
		TNode rightNode = new TNode(rightContent);

		currentNode.setRightChild(rightNode);
		setCurrentNode(rightNode);
		i++;
	}

	
	
	void setRootNode(TNode tmpNode){
		rootNode = tmpNode;
	}
	TNode getRootNode(){
		return rootNode;
	}
	void setCurrentNode(TNode tmpNode){
		currentNode = tmpNode;
	}
	TNode getCurrentNode(){
		return currentNode;
	}
	int size(){
		return i;
	}
}

class TNode {
	private String content;
	private TNode leftChild;
	private TNode rightChild;

	TNode() {
		this("");
	}

	TNode(String content) {
		this.content = content;
		leftChild = null;
		rightChild = null;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public String getContent() {
		return content;
	}

	public void setLeftChild(TNode leftChild) {
		this.leftChild = leftChild;
	}

	public TNode getLeftChild() {
		return leftChild;
	}

	public void setRightChild(TNode rightChild) {
		this.rightChild = rightChild;
	}

	public TNode getRightChild() {
		return rightChild;
	}

}
